﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Forms.DataVisualization.Charting;
using Pdm.Commons;

namespace PdmGui
{
    /// <summary>
    /// Interaktionslogik für Window1.xaml
    /// </summary>
    public partial class Window1 : Window
    {
        public Window1()
        {
            InitializeComponent();
            loadPdm();
        }
        public void loadPdm()
        {
            DmuList test = getTestList();
            productItems.DataContext = test;
            productItems.ItemsSource = test;
        }
        public void testChart()
        {
            // Populate series data
            double[] yValues = { 65.62, 75.54, 60.45, 34.73, 85.42, 55.9, 63.6, 55.2, 77.1 };
            string[] xValues = { "France", "Canada", "Germany", "USA", "Italy", "Spain", "Russia", "Sweden", "Japan" };
            mainChart.Series.Add("Default");
            mainChart.ChartAreas.Add("Default");

            mainChart.Series["Default"].Points.DataBindXY(xValues, yValues);

            // Set radar chart type
            mainChart.Series["Default"].ChartType = SeriesChartType.Radar;

            // Set radar chart style (Area, Line or Marker)
            mainChart.Series["Default"]["RadarDrawingStyle"] = "Area";

            // Set circular area drawing style (Circle or Polygon)
            mainChart.Series["Default"]["AreaDrawingStyle"] = "Polygon";

            // Set labels style (Auto, Horizontal, Circular or Radial)
            mainChart.Series["Default"]["CircularLabelsStyle"] = "Horizontal";

            // Show as 3D
            mainChart.ChartAreas["Default"].Area3DStyle.Enable3D = true;
        }
        private static DmuList getTestList()
        {
            DmuList dmus = new DmuList();
            dmus.Add(new Dmu("Prod1"));
            dmus.Add(new Dmu("Prod2"));
            dmus.Add(new Dmu("Prod3"));
            dmus.coefficients.Add(new Specification(Pdm.Commons.Type.Input, "InputDummy"));
            dmus.coefficients.Add(new Specification(Pdm.Commons.Type.Output, "Out1"));
            dmus.coefficients.Add(new Specification(Pdm.Commons.Type.Output, "Out2"));
            dmus.coefficients.Add(new Specification(Pdm.Commons.Type.Output, "Out3"));
            dmus.coefficients.Add(new Specification(Pdm.Commons.Type.Output, "Out4"));
            dmus.coefficients.Add(new Specification(Pdm.Commons.Type.Output, "Out5"));
            dmus.coefficients.Add(new Specification(Pdm.Commons.Type.Output, "Out6"));
            dmus.coefficients.Add(new Specification(Pdm.Commons.Type.Output, "Out7"));
            dmus.coefficients.Add(new Specification(Pdm.Commons.Type.Output, "Out8"));

            dmus[0].coefficients.Add(new SpecificationInstance(dmus.coefficients[0], 1));
            dmus[0].coefficients.Add(new SpecificationInstance(dmus.coefficients[1], 1.52380));
            dmus[0].coefficients.Add(new SpecificationInstance(dmus.coefficients[2], 0.94117));
            dmus[0].coefficients.Add(new SpecificationInstance(dmus.coefficients[3], 1.90909));
            dmus[0].coefficients.Add(new SpecificationInstance(dmus.coefficients[4], 1.53846));
            dmus[0].coefficients.Add(new SpecificationInstance(dmus.coefficients[5], 1.46666));
            dmus[0].coefficients.Add(new SpecificationInstance(dmus.coefficients[6], 1.40909));
            dmus[0].coefficients.Add(new SpecificationInstance(dmus.coefficients[7], 1.90625));
            dmus[0].coefficients.Add(new SpecificationInstance(dmus.coefficients[8], 1.61904));

            dmus[1].coefficients.Add(new SpecificationInstance(dmus.coefficients[0], 1));
            dmus[1].coefficients.Add(new SpecificationInstance(dmus.coefficients[1], 1.76190));
            dmus[1].coefficients.Add(new SpecificationInstance(dmus.coefficients[2], 1.41176));
            dmus[1].coefficients.Add(new SpecificationInstance(dmus.coefficients[3], 1.27272));
            dmus[1].coefficients.Add(new SpecificationInstance(dmus.coefficients[4], 1.46153));
            dmus[1].coefficients.Add(new SpecificationInstance(dmus.coefficients[5], 1.73333));
            dmus[1].coefficients.Add(new SpecificationInstance(dmus.coefficients[6], 1.72727));
            dmus[1].coefficients.Add(new SpecificationInstance(dmus.coefficients[7], 1.96875));
            dmus[1].coefficients.Add(new SpecificationInstance(dmus.coefficients[8], 2.04761));

            dmus[2].coefficients.Add(new SpecificationInstance(dmus.coefficients[0], 1));
            dmus[2].coefficients.Add(new SpecificationInstance(dmus.coefficients[1], 1.61904));
            dmus[2].coefficients.Add(new SpecificationInstance(dmus.coefficients[2], 0.97058));
            dmus[2].coefficients.Add(new SpecificationInstance(dmus.coefficients[3], 1.45454));
            dmus[2].coefficients.Add(new SpecificationInstance(dmus.coefficients[4], 1.00000));
            dmus[2].coefficients.Add(new SpecificationInstance(dmus.coefficients[5], 1.06666));
            dmus[2].coefficients.Add(new SpecificationInstance(dmus.coefficients[6], 1.72727));
            dmus[2].coefficients.Add(new SpecificationInstance(dmus.coefficients[7], 2.03125));
            dmus[2].coefficients.Add(new SpecificationInstance(dmus.coefficients[8], 1.76190));

            return dmus;

            /*PdmOptimization pdm = new PdmOptimization(dmus, 0);
            pdm.urmWeights.Add(new SpecificationInstance(pdm.dmuList.coefficients[0], 11));
            pdm.urmWeights.Add(new SpecificationInstance(pdm.dmuList.coefficients[1], 21));
            pdm.urmWeights.Add(new SpecificationInstance(pdm.dmuList.coefficients[2], 34));
            pdm.urmWeights.Add(new SpecificationInstance(pdm.dmuList.coefficients[3], 11));
            pdm.urmWeights.Add(new SpecificationInstance(pdm.dmuList.coefficients[4], 13));
            pdm.urmWeights.Add(new SpecificationInstance(pdm.dmuList.coefficients[5], 15));
            pdm.urmWeights.Add(new SpecificationInstance(pdm.dmuList.coefficients[6], 22));
            pdm.urmWeights.Add(new SpecificationInstance(pdm.dmuList.coefficients[7], 32));
            pdm.urmWeights.Add(new SpecificationInstance(pdm.dmuList.coefficients[8], 21));*/
        }
    }
}
